/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upc.clase.demo.service.impl;

import edu.upc.clase.demo.dao.ParticipanteDao;
import edu.upc.clase.demo.dao.impl.ParticipanteDaoImpl;
import edu.upc.clase.demo.entity.Participante;
import edu.upc.clase.demo.service.ParticipanteService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @author 
 */
    
    @Service 
    public class ParticipanteServiceImpl implements ParticipanteService{
        
    private static Logger log = LoggerFactory.getLogger(ParticipanteDaoImpl.class);    
    
    @Autowired
    private ParticipanteDao participanteDao;

    @Override
    public Integer insertar(Participante participante) {
        if (participante.getNoparticipante().length() > 0) {
            log.info("Creando Participante");
            return participanteDao.insertar(participante);
        }       
        return null;
    }

    @Override
    public Participante buscar(Integer id) {
            return participanteDao.buscar(id);
    }

    @Override
    public Participante autenticar(String correo) {
        if (correo.contains("@")) {
            return participanteDao.buscar(correo);
        }
        return null;
    }


    
}
